<template>
    <div>
        <Header></Header>
        <h2>{{dat.title}}</h2>
        <p>作者：{{dat.author.loginname}} 发表于：{{$utils.goodTime(dat.create_at)}}</p>
        <hr>
        <h3>网友回复：</h3>
        <ul>
            <li v-for="i in dat.replies" v-if="dat.replies">
                <p >评论者：{{i.author.loginname}} 评论于：{{$utils.goodTime(i.create_at)}}</p>
                <article>{{i.content}}</article>
            </li>
        </ul>
        <Footer></Footer>
    </div>
</template>

<script>
    import Header from '../components/header.vue'
    import Footer from '../components/footer.vue'
    export default{
        components:{Header,Footer},
        data(){
            return{
                id:this.$route.params.id,
                dat:{}
            }
        },
        created(){
            this.getData()
        },
        methods:{
            getData(){
                this.$api.get('topic/'+this.id,null,r=>{
                    this.dat= r.data
                })
            }
        }
    }
</script>

<style>

</style>